import java.util.Arrays;

public class Compare {
    public static int repeat(int[] arr1) {
        int count = 0;
        int tmp = arr1[0];
        for (int i = 0; i < arr1.length; i++) {
            if (arr1[i] == tmp) {
                count++;
            } else if (arr1[i] != tmp) {
                count--;
            }
            if (count == 0) {
                tmp = arr1[i];
                count++;
            }
        }
        return tmp;
    }
   /* public static int repeat(int[] arr1){
        Arrays.sort(arr1);
        return arr1[arr1.length/2];
    }
*/
    public static void main(String[] args) {
        int[] arr = {2,3,3,2,2,3,2};
         int ret = repeat(arr);
        System.out.println(ret);
    }
}
